import time
def sort(nums):
    s = True
    while s:
        s = False
        for i in range(len(nums) - 1):
            if nums[i] > nums[i+1]:
                nums[i], nums[i+1] = nums[i+1], nums[i]
                s = True
def rl(fi):
    file=open(fi,'r')
    data = file.readlines()
    return data
m1 = rl("m1_sorted.txt")
m2 = rl("m2_reverse.txt")
m3 = rl("m3_shuffle.txt")

times = time.time()
sort(m1)
timef = time.time()
print(round(timef - times) * 1000)

times = time.time()
sort(m2)
timef = time.time()
print(round(timef - times) * 1000)

times = time.time()
sort(m3)
timef = time.time()
print(round(timef - times) * 1000)
